﻿using System;
using HigLabo.Net.Extensions;

namespace HigLabo.Net.WindowsLive
{
    /// <summary>
    /// 
    /// </summary>
    public class UserAddresses : ResponseObject
    {
        /// <summary>
        /// 
        /// </summary>
        public UserAddress Personal { get; private set; }
        /// <summary>
        /// 
        /// </summary>
        public UserAddress Business { get; private set; }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsonText"></param>
        public UserAddresses(String jsonText)
        {
            this.SetProperty(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsonText"></param>
        public override void SetProperty(String jsonText)
        {
            var d = this.SetData(jsonText);

            if (d.ContainsKey("personal") == true)
            {
                this.Personal = new UserAddress(d.ToString("personal"));
            }
            if (d.ContainsKey("business") == true)
            {
                this.Business = new UserAddress(d.ToString("business"));
            }
        }
    }
}
